#include  <unistd.h>
#include <stdio.h>
/**
 * int access( const *pathname, int mode )
 * 注意*pathname 要使用绝对路径
 * int mode 可以有四种模式  F_OK ==0  R_OK==4    W_OK==2  X_OK ==1
*/
int main (int argc , char **argv)
{
    int rc=-1;
    rc =  access("/home/xp/test/access_test/test",R_OK);
    if( rc == 0)
        printf("**********read permission ok**********\n");
    rc =  access("/home/xp/test/access_test/test",W_OK);
        if( rc == 0)
            printf("**********write permission ok**********\n");
    rc =  access("/home/xp/test/access_test/test",F_OK);
        if( rc == 0)
            printf("**********test exist **********\n");
    rc =  access("/home/xp/test/access_test/test",X_OK);
        if( rc == 0)
            printf("**********execute permission ok**********\n");

    return 0;
}